package com.avventa.cq5;

import java.io.IOException;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;

import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.SlingHttpServletResponse;
import org.apache.sling.api.servlets.SlingAllMethodsServlet;

@Component(label = "AVVENTA TEST SERVLET", immediate = true)
@Properties({
		@Property(name="service.description", value="Avventa Test Servlet"),
		@Property(name="sling.servlet.paths", value = { "/services/myservlet"}) })
@Service(value=Servlet.class)
public class MyServlet extends SlingAllMethodsServlet {
	
	
	@Override
	protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {
		
		String name = request.getParameter("name");
		response.getWriter().println(name);
	}
	

}
